<?php
/**
 * RegistroStrumenti
 *
 * @author     luigi.pastore (gigi@la-fabbrica.org)
 * @package    registrostrumenti
 * @copyright  Copyright (c) 2014 Luigi Pastore
 */

/**
 * Defininiamo costanti di percorso
 */
# Impostiamo timezone e locale
date_default_timezone_set( 'Europe/Rome' );
setlocale( LC_TIME, 'ita', 'it_IT' );

defined( 'APPLICATION_PATH' )
	|| define( 'APPLICATION_PATH', realpath( dirname( __FILE__ ) . '/../application' ) );

defined( 'APPLICATION_ENV' )
	|| define( 'APPLICATION_ENV', ( getenv( 'APPLICATION_ENV' ) ? getenv( 'APPLICATION_ENV' ) : 'development' ) );

defined( 'BASE_PATH' )
	|| define( 'BASE_PATH', realpath( dirname( __FILE__ ) . '/../' ) );

/**
 * Aggiorno path per l'include delle librerie e del model
 * */
ini_set('include_path', APPLICATION_PATH );

/**
 * Abilito errori solo in sviluppo
 */
if( APPLICATION_ENV == 'development' OR APPLICATION_ENV == 'staging' )
{
    error_reporting( E_ALL ^ E_NOTICE );
    ini_set( 'display_errors', 'true' );
}
else
{
    error_reporting( 0 );
    ini_set( 'display_errors', 'false' );    
}

/**
 * AutoLoad!
 */
require_once APPLICATION_PATH . '/classes/core/autoloader.php';
new AutoLoader;
//spl_autoload_register(array('AutoLoader', 'load'));

/**
 * Go!
 */
$application = Classes_Core_Application::getInstance();
$application->run();
